<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link th:href="@{/css/style.css}" rel="stylesheet" type="text/css" />
<script type="text/javascript" th:src="@{/js/jquery.js}"></script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li>采购管理</li>
    <li>品牌管理</li>
    <li>修改</li>
  </ul>
</div>
<div class="formbody">
  <div class="formtitle"><span>品牌信息</span></div>
  <form th:action="@{/purchase/brand/doBrandUpdate}" method="post" id="brandUpFrom">
  <ul class="forminfo">
    <input name="brandId" type="hidden" th:value="${upbrand.brandId}" class="dfinput"/>
    <li>
      <label>品牌名称</label>
      <input id="brandName" name="brandName" type="text" th:value="${upbrand.brandName}" class="dfinput" />
      <i>必填，不能超过50个字符</i>
    </li>
    <li>
      <label>状态</label>
      <select id="brandStatus" class="dfselect" name="brandStatus">
        <option th:value="0">请选择</option>
          <option th:value="1" th:selected="${upbrand.brandStatus==1}?'true':'false'">可用</option>
          <option th:value="2" th:selected="${upbrand.brandStatus==2}?'true':'false'">不可用</option>
        </select>
      <i>必选</i>
    </li>
    <li>
      <label>创建人</label>
      <input name="createId" type="hidden" th:value="${upbrand.createId==null?'':upbrand.users.uId}">
      <input name="" type="text" th:value="${upbrand.createId==null?'':upbrand.users.uname}"  readonly="readonly" class="roinput" />
      <i>不能编辑</i>
    </li>
    <li>
      <label>创建时间</label>
      <input name="createTime" type="text" th:value="${#dates.format(upbrand.createTime,'yyyy-MM-dd HH:mm:ss')}" readonly="readonly" class="roinput" />
      <i>不能编辑</i>
    </li>
    <li>
      <label>&nbsp;</label>
      <input onclick="editBrand()" type="button" class="btn" value="确定"/>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input name="" type="submit" class="btn" value="返回" th:onclick="/erp1/purchase/brand/brandAll"/>
    </li>
  </ul>
  </form>
</div>
<!--添加品牌表单验证-->
<script>
  $(function () {
    $("#brandName").blur(function () {
      brandName();
    });
    $("#brandStatus").blur(function () {
      state();
    })
  });
  function brandName() {
    if($("#brandName").val()==""){
      return false;
    }else {
      return true;
    }
  }
  function state() {
    if($("#brandStatus").val()==0){
      return false;
    }else{
      return true;
    }
  }
  function editBrand() {
    if(brandName()&&state()){
      $("#brandUpFrom").submit()
    }else {
      confirm("修改品牌失败！")
    }
  }
</script>
</body>
</html>
